package com.woniu.guoguo.service.impl;

import com.woniu.guoguo.model.Order;
import com.woniu.guoguo.model.User;
import com.woniu.guoguo.dao.UserMapper;
import com.woniu.guoguo.service.IUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Richie
 * @since 2020-11-03
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public User getuser(String phone) {
        User user=userMapper.getuser(phone);
        return user;
    }

    @Override
    public int adduser(String phone, String username, String password,String inviteCode) {
        int r=userMapper.adduser(phone,username,password,inviteCode);
        return r;
    }
    @Override
    public User changeUser(int userId) {
        User user = userMapper.changeUser(userId);
        return user;
    }

    @Override
    public void changeInfo(User user) {
        userMapper.changeInfo(user);
    }

    @Override
    public User findInvite(String code) {
        User user = userMapper.findinvite(code);
        return user;
    }

    @Override
    public void addinvite(User user) {
        userMapper.addinvite(user);
    }

    @Override
    public User findbyuserid(int id) {
        User findbyuserid = userMapper.findbyuserid(id);
        return findbyuserid;
    }

    @Override
    public void addorder(Order order) {
        userMapper.addOrder(order);
    }

    @Override
    public void changebalance(double balance, int userId) {
        userMapper.changeblance(balance,userId);
    }

    @Override
    public void changeshop(double balance, int shopId) {
        userMapper.changeshop(balance,shopId);
    }


}
